package com.nami.store.dubbo;

import com.nami.store.api.request.grpmember.GrpMemberAddReq;
import com.nami.store.api.service.RemoteGroupMemberService;
import com.nami.store.api.response.groupmember.GroupMemberDTO;
import com.nami.store.biz.groupmembs.application.GrpMembAppService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;

import java.util.List;
import java.util.Map;

@Slf4j
@RequiredArgsConstructor
@DubboService
public class RemoteGrpMembersServiceImpl implements RemoteGroupMemberService {

    private final GrpMembAppService membAppService;

    @Override
    public List<GroupMemberDTO> getGroupMembers(String groupId) {
        return membAppService.getGrpMembers(groupId);
    }

    @Override
    public GroupMemberDTO getGroupMember(String groupId, String userId) {
        return membAppService.getGrpMemberByGrpIdAndUserId(groupId, userId);
    }

    @Override
    public List<GroupMemberDTO> getGroupMembersExcludeMe(String grpId, String userId) {
        return membAppService.getGrpMembersExceptMe(grpId, userId);
    }

    @Override
    public boolean batchSave(List<GrpMemberAddReq> addRequests) {
        return membAppService.batchSave(addRequests);
    }

    @Override
    public List<GroupMemberDTO> getGrpMembsByGrpIdAndUserIds(String groupId, List<String> userIds) {
        return membAppService.getGrpMembsByGrpIdAndUserIds(groupId, userIds);
    }

    @Override
    public Map<String, GroupMemberDTO> getGrpMembsByUserIds(String grpId, List<String> userIds) {
        return membAppService.getGrpMembsByUserIds(grpId, userIds);
    }
}
